home *** CD-ROM | disk | FTP | other *** search
- #!/bin/perl
-
- require "cgi-lib.pl";
-
- if (&ReadParse(*input)) {
- print &PrintHeader;
- print "<h1>The solutions to your SWORDS request</h1>";
- $num = length($input{'pat'});
- print "<br><br>Solutions for : ";
- print $input{'pat'};
- print "<br> No more than : ";
- print $input{'max'};
- print "<br><br>";
- $ar = "$num $input{'pat'} $input{'max'}";
- $ar =~ s/\W/ /g; # untaint the input
- open(PROG,"./swords $ar |");
- $fo = <PROG>;
- print $fo;
- print "<OL>";
- while(<PROG>)
- { last if $_ eq ",,,\n";
- print $_;
- print"<br>";
- }
- print"</OL>";
- print <PROG>;
- }
- else {
- print &PrintHeader;
-
- print <<EOF
- <title> Word Searching Program </title>
- <img src="http://blackcat.brynmawr.edu/~nswoboda/cross-t.gif" align=center>
- <h1> Word Searching Program</h1><br>
- Greetings!<p>
- This set up helps you find words from a standard
- system dictionary. All you have to do is provide
- a pattern, placing a "_" in place of any character.
- For example, <b>d___r</b> would search for all the 5
- letter words that begin with <b>d</b> and end with an
- <b>r</b>.<p>
- <form method="post" action="/cgi-bin/nik/swords.pl">
- <input name = "pat"><p>
- Select the maximum number of solutions to return
- <SELECT NAME="max"><OPTION SELECTED> 25
- <OPTION> 50 <OPTION> 75 <OPTION> 100 </SELECT> <P>
- <INPUT TYPE="reset" VALUE="Clear">
- <input type="submit" value="Find words!">
- </form> <b> PS:</b> Try to you use this to find
- the longest word in the dictionary. <hr>
- <i>Written by Nik Swoboda (nswoboda\@blackcat.brynmawr.edu)
- </i></html>
- EOF
- }
-